<template>
	<view class="page">
		<fa-navbar title="入会申请" :isBackIndex="isBackIndex"></fa-navbar>
		<view class="membership" v-if="status == 1">
			<image src="../../static/images/ruhui2.jpg" mode=""></image>

			<view class="richText">
				<!-- <u-parse :html="pageInfo.content" :tag-style="vuex_parse_style" :domain="vuex_config.upload ? vuex_config.upload.cdnurl : ''"></u-parse> -->
				<characters />
			</view>

			<view class="radio">
				<u-checkbox-group>
					<u-checkbox @change="checkboxChange" v-model="item.checked" v-for="(item, index) in list"
						:key="index" :name="item.name">
						<view class="" style="color: #fcf5c4;font-size: 26rpx;">
							我已阅读并同意《中国工商业联合会章程》
						</view>
					</u-checkbox>
				</u-checkbox-group>
			</view>
			<view class="line">

			</view>
			<view class="title">
				· 入会申请信息填写
			</view>
			<view class="url">方式1：电脑浏览器打开链接填写</view>
			<view class="copy" @click="copyUrl">
				复制链接
			</view>
			<view class="url1">方式2：手机端在线填写</view>
			<view class="copy1" @click="goFillIn">
				立即填写
			</view>

		</view>
		<view class="membership" v-if="status == 2">
			<image src="../../static/images/ruhui2.jpg" mode=""></image>

			<view class="richText">
				<!-- <u-parse :html="pageInfo.content" :tag-style="vuex_parse_style" :domain="vuex_config.upload ? vuex_config.upload.cdnurl : ''"></u-parse> -->
				<characters />
			</view>
			<view class="line">

			</view>
			<view class="title">
				· 入会申请信息填写
			</view>
			<view class="url" style="top:983rpx">
				个人会员申请&nbsp;&nbsp;&nbsp;{{row.create_time}}&nbsp;&nbsp;&nbsp;{{audit_status}}
			</view>
			<view class="copy" @click="godetail" style="top:975rpx">
				查看详情
			</view>
		</view>
	</view>
</template>

<script>
	import characters from '@/components/characters/characters.vue'; // 文字
	export default {
		components: {
			characters
		},
		data() {
			return {
				isBackIndex: 3,
				row: {},
				status: 1,
				pageInfo: {},
				isRead: false,
				audit_status: '',
				create_time: '',
				list: [{
					name: '',
					checked: false,
					disabled: false
				}, ],
				// u-radio-group的v-model绑定的值如果设置为某个radio的name，就会被默认选中
				value: 'orange',

			}
		},
		onLoad: async function() {
			let res = await this.$api.getMyboutus();
			if (!res.code) {
				this.$u.toast(res.msg);
				return;
			}
			this.pageInfo = res.data.pageInfo;
			this.getAuditing()
		},
		methods: {
			async getAuditing() {
				let res = await this.$api.getAuditing();
				if (!res.code) {
					this.$u.toast(res.msg);
					return;
				}
				if (res.data.row) {
					this.status = 1
					this.row = res.data.row
					if (res.data.row.audit_status == 0) {
						this.audit_status = '待审核'
					} else if (res.data.row.audit_status == 1) {
						this.audit_status = '审核通过'
					} else if (res.data.row.audit_status == 2) {
						this.audit_status = '审核不通过'
					}


				} else {
					this.status = 2
				}
			},
			// 选中某个复选框时，由checkbox时触发
			checkboxChange(e) {
				this.isRead = e.value
			},
			godetail() {
				this.$u.route('/pages/applicationForm/auditing');

			},
			goFillIn() {
				if (this.isRead) {
					this.$u.route('/pages/applicationForm/applicationForm');
				} else {
					uni.showModal({
						title: '友情提示',
						content: '请阅读并勾选《中国工商业联合会章程》',
						showCancel: false
					})
				}
			},
			copyUrl() {
				if (this.isRead) {
					const urlToCopy = "https://fzsxh.wisherlife.com/web/";

					if (uni.canIUse('setClipboardData')) {
						uni.setClipboardData({
							data: urlToCopy,
							success: function() {
								uni.showToast({
									title: '复制成功',
									icon: 'success'
								});
							},
							fail: function() {
								uni.showToast({
									title: '复制失败',
									icon: 'error'
								});
							}
						});
					} else {
						uni.showToast({
							title: '该平台不支持剪贴板功能',
							icon: 'error'
						});
					}
				} else {
					uni.showModal({
						title: '友情提示',
						content: '请阅读并勾选《中国工商业联合会章程》',
						showCancel: false
					})
				}

			}
		}
	}
</script>

<style lang="scss" scoped>
	.page {
		height: 100vh;
	    overflow: hidden;
	}

	::-webkit-scrollbar {
		width: 10rpx;
		height: 20rpx;
		color: #ffffff;
	}


	/*定义滚动条轨道 内阴影+圆角*/
	::-webkit-scrollbar-track {
		-webkit-box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.3);
		box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.1);
		border-radius: 10px;
		// background-color:#FFFFFF;
	}


	/*定义滑块 内阴影+圆角*/
	::-webkit-scrollbar-thumb {
		border-radius: 10px;
		-webkit-box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.3);
		box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.1);
		background-color: #fcf6c4;
	}

	.membership {
		width: 100%;
		height: 100vh;
		position: relative;

		image {
			width: 100%;
			height: 100%;
		}


		.richText {
			position: absolute;
			top: 20%;
			left: 58rpx;
			width: 635rpx;
			max-height: 42%;
			border-radius: 10rpx;
			border: solid 3rpx #fcf5c4;
			// padding: 36rpx;
			padding: 20rpx 0rpx 20rpx 25rpx;
			/* 设置最大高度，超出部分产生滚动条 */
			overflow-y: scroll;

		}

		.line {
			position: absolute;
			top: 68%;
			left: 58rpx;
			width: 630rpx;

			height: 1rpx;
			background-color: #ffffff;

		}

		.title {
			position: absolute;
			top: 69%;
			left: 58rpx;
			color: #fff;
			font-weight: bold;
			font-size: 28rpx;
		}

		.radio {
			position: absolute;
			top: 63.5%;
			left: 58rpx;
		}

		.url {
			position: absolute;
			top: 73%;
			color: #fff;
			left: 8.3%;
			font-size: 26rpx;
		}


		.copy {
			position: absolute;
			top:72.5%;
			right: 10%;
			padding: 0rpx 10rpx;
			height: 50rpx;
			background-color: #e9b929;
			border-radius: 12rpx;
			text-align: center;
			line-height: 50rpx;
			color: #fff;
			font-size: 27rpx;
		}

		.url1 {
			position: absolute;
			top: 77%;
			color: #fff;
			left: 8.3%;
			font-size: 26rpx;
		}

		.copy1 {
			position: absolute;
			top: 81%;
			right: 8%;
			width: 637rpx;
			height: 81rpx;
			background-color: #e9b929;
			border-radius: 12rpx;
			text-align: center;
			line-height: 81rpx;
			color: #fff;
			font-size: 30rpx;
		}

	}
</style>